package common.fengkai.filepost.service.impl;

import com.alibaba.fastjson.JSONObject;
import common.fengkai.filepost.bean.mysqlBean.EmpUser;
import common.fengkai.filepost.dao.mysqldao.EmpUserMapper;
import common.fengkai.filepost.service.Buy;
import common.fengkai.filepost.utils.SpringBeanUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Fengkai
 * @creat 2022/2/14
 */
@Component
@Slf4j
public class Girl implements Buy {
    @Override
    public String  buy () {
        SqlSessionFactory mysqlSqlsessionBean = (SqlSessionFactory) SpringBeanUtils.getBean("mysqlSqlsessionBean");
        SqlSession sqlSession = mysqlSqlsessionBean.openSession();
        EmpUserMapper mapper = sqlSession.getMapper(EmpUserMapper.class);
        EmpUser empUser = mapper.selectByPrimaryKey(1);
        log.info(JSONObject.toJSONString(empUser));
        log.info("女孩买了衣服");
        return "";
    }
}
